package operation;
import book.Book;
import book.Booklist;

import java.util.Scanner;

public class FindOperation implements IOPeration{
    public void work(Booklist booklist){
        System.out.println("查找图书.....");
        System.out.println("请输入要查找的书名");
        Scanner scanner =new Scanner(System.in);
        String bookname=scanner.nextLine();
        int currentSize= booklist.getUsedSize();
        for(int i=0;i< currentSize;i++){
            Book book=booklist.getBook(i);
            if(book.getName().equals(bookname)) {
                System.out.println("找到了这本书");
                System.out.println(book);
                return ;
            }

        }
        System.out.println("没有你要找的书");

    }
}
